//package com.plian.system.controller.dj;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.plian.Tools.Func;
//import com.plian.Tools.StringPool;
//import com.plian.Tools.base.BaseController;
//import com.plian.Tools.pagedata.PageData;
//import com.plian.system.config.Resubmit;
//import com.plian.system.dao.sys.file.FileDao;
//import com.plian.system.entity.dj.DjPartyBrandInfo;
//import com.plian.system.model.CommonCode;
//import com.plian.system.model.ListResult;
//import com.plian.system.model.R;
//import com.plian.system.mybatis.search.SearchEntity;
//import com.plian.system.mybatis.search.SearchParamEntiy;
//import com.plian.system.mybatis.search.TokenSearch;
//import com.plian.system.mybatis.support.Condition;
//import com.plian.system.mybatis.support.Query;
//import com.plian.system.service.dj.IDjPartyBrandInfoService;
//import com.plian.system.vo.dj.DjPartyBrandInfoVO;
//import com.plian.system.wrapper.dj.DjPartyBrandInfoWrapper;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiResponse;
//import io.swagger.annotations.ApiResponses;
//import lombok.AllArgsConstructor;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.validation.Valid;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//
///**
// * 国资党建-党建品牌图管理
// **/
//@RestController
//@AllArgsConstructor
//@RequestMapping("api/party_brandinfo")
//@Api(value = "国资党建-党建品牌图管理", tags = "国资党建-党建品牌图管理")
//public class DjPartyBrandInfoController extends BaseController {
//
//
//    private final IDjPartyBrandInfoService partyBrandInfoService;
//
//    private final DjPartyBrandInfoWrapper djPartyBrandInfoWrapper;
//
//    @Autowired
//    private FileDao fileDao;
//
//    /**
//     * 新增或修改
//     */
//    @ApiOperation(value = "新增或修改", notes = "新增或修改")
//    @ApiResponses({
//            @ApiResponse(code = 200, message = "操作成功"),
//            @ApiResponse(code = 500, message = "服务器错误"),
//    })
//    @PostMapping("/submit")
//    @Resubmit(delaySeconds = 0)
//    public R submit(@Valid @RequestBody DjPartyBrandInfo partyBrandInfo) {
//        return R.status(partyBrandInfoService.submit(partyBrandInfo));
//    }
//
//    /**
//     * 查询详情
//     */
//    @ApiOperation(value = "查询详情", notes = "查询详情")
//    @ApiResponses({
//            @ApiResponse(code = 200, message = "操作成功"),
//            @ApiResponse(code = 500, message = "服务器错误"),
//    })
//    @PostMapping("/detail")
//    public R<DjPartyBrandInfoVO> detail(@RequestBody DjPartyBrandInfo brandInfo) {
//        DjPartyBrandInfo detail = partyBrandInfoService.getOne(Condition.getQueryWrapper(brandInfo));
//        return R.data(djPartyBrandInfoWrapper.entityToVO(detail));
//    }
//
//    /**
//     * 列表分页
//     */
//    @ApiOperation(value = "列表分页", notes = "列表分页")
//    @ApiResponses({
//            @ApiResponse(code = 200, message = "操作成功"),
//            @ApiResponse(code = 500, message = "服务器错误"),
//    })
//    @PostMapping("/list")
//    public ListResult<DjPartyBrandInfoVO> list(@RequestBody Query query) {
//        List<SearchEntity> entityList = query.getSearch();
//        if (query.getAscs() == null && query.getDescs() == null) {
//            query.setDescs("create_time");
//        }
//        QueryWrapper<DjPartyBrandInfo> queryWrapper = SearchParamEntiy.getQueryWrapper(
//                Condition.getQueryWrapper(new DjPartyBrandInfo()), entityList
//        );
//        TokenSearch<DjPartyBrandInfo> tokenSearch = new TokenSearch<>();
//		tokenSearch.addTokenQuery(queryWrapper, query);
//        IPage<DjPartyBrandInfo> pages = partyBrandInfoService.page(Condition.getPage(query), queryWrapper);
//        List<DjPartyBrandInfoVO> djPartyBrandInfoVOS = djPartyBrandInfoWrapper.entityToVO(pages.getRecords());
//        for (DjPartyBrandInfoVO item : djPartyBrandInfoVOS) {
//            List<HashMap> docList = new ArrayList<>();
//            try {
//                List<PageData> list = fileDao.findParentId(item.getId().toString());
//                list.forEach(e -> {
//                    docList.add(e);
//                });
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//            item.setDocList(docList);
//        }
//        ListResult<DjPartyBrandInfoVO> listResult = new ListResult<>(CommonCode.SUCCESS);
//        listResult.setList(djPartyBrandInfoVOS);
//        listResult.setTotal(Long.valueOf(pages.getTotal()).intValue());
//        return listResult;
//    }
//
//
//    /**
//     * 删除
//     */
//    @ApiOperation(value = "删除", notes = "删除")
//    @ApiResponses({
//            @ApiResponse(code = 200, message = "操作成功"),
//            @ApiResponse(code = 500, message = "服务器错误"),
//    })
//    @Transactional(rollbackFor = Throwable.class)
//    @PostMapping("/submit")
//    public R remove(@RequestBody DjPartyBrandInfoVO partyBrandInfoVO) {
//        List<Long> ids = partyBrandInfoVO.getIds();
//        return R.status(partyBrandInfoService.deleteLogic(Func.toLongList(StringUtils.join(ids, StringPool.COMMA))));
//    }
//
//
//}
